<template src="./index.html"></template>

<script>
import MedicalRecordTestTubeInfoService from "../../../../../_services/medicalRecordTestTubeInfo.service";
export default {
  name: "TianDingPatientMeTestTubeDetailComponent",
  data() {
    return {
      testTubeList: []
    };
  },
  mounted() {
    this.getTestTubeInfoListByUserID();
  },
  methods: {
    getTestTubeInfoListByUserID() {
      this.indicator$.open("正在加载...");
      this.testTubeList = [];
      let user = JSON.parse(this.local$.getItem("tdUser"));
      let params = {};
      params.userid = user.UserID;
      MedicalRecordTestTubeInfoService.getTestTubeInfoListByUserID(params).then(
        response => {
          if (response && response.Data.length > 0) {
            this.testTubeList = response.Data;
          }
          this.indicator$.close();
        }
      );
    },
    btnModify(item) {
      this.local$.removeItem("tdTestDetail");
      if (item !== undefined) {
        this.local$.setItem("tdTestDetail", JSON.stringify(item));
        this.$router.push({
          name: "tdPatientMeMedicalTestTubeDetailModify",
          params: item
        });
      } else {
        this.$router.push({
          name: "tdPatientMeMedicalTestTubeDetailModify"
        });
      }
    },
    btnPrev() {
      let menu = JSON.parse(this.local$.getItem("tdMeLeftMenus"));
      menu.prev = "prev";
      this.$emit("change", menu);
    },
    btnGenerate() {
      this.$emit("change", "detail");
    }
  }
};
</script>
